import Vue from 'vue'

const mutations = {
  CHANGEPOSITION (state,position) {
    position = JSON.parse(JSON.stringify(position))
    for(let key in position){
      Vue.set(state.position, key, position[key])
    }
    state.chartModify++
  },
  CHANGEOPTION (state,option) {
    option = JSON.parse(JSON.stringify(option))
    for(let key in option){
      if(key==='legend'&&option.legend){
        for(let attr in option.legend){
          Vue.set(state.option.legend, attr, option.legend[attr])
        }
      }else{
        Vue.set(state.option, key, option[key])
      }
      
    }
  }
}

export default mutations